---
title: 药品不良事件
---
<template>
  <my-wrapper :header="null">
    <div>
      <el-button plain type="primary" @click="rowNew">新增</el-button>
      <el-button plain type="success" >导出</el-button>
<!--      <el-button plain type="success" >审核</el-button>-->
<!--      <el-button plain type="danger" >审核不通过</el-button>-->
<!--      <el-button plain type="warning" >取消审核</el-button>-->
<!--      <el-button plain type="primary" >转发</el-button>-->
<!--      <el-button plain type="success" >处理</el-button>-->
      <!--表格内容-->
      <el-table
        ref="list"
        :data="tableData"
        style="width: 100%;margin-top: 1vw;"
        border
        stripe
        highlight-current-row
        :default-sort="{prop: 'date', order: 'descending'}"
        @row-click="handleRowClick"
        @select-all="handleCheckedAllAndCheckedNone"
        @select="handleCheckedAllAndCheckedNone"
        @row-dblclick="tableDblclick">
        <el-table-column property="patientName" label="患者姓名" width="100" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column property="sex" label="性别" width="50"></el-table-column>
        <el-table-column property="adverseDate" label="报告日期" width="120" sortable :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <i class="el-icon-time"></i>
            <span style="margin-left: 5px">{{scope.row.adverseDate}}</span>
          </template>
        </el-table-column>
        <el-table-column property="eventDate" label="发生日期" width="120" sortable :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <i class="el-icon-time"></i>
            <span style="margin-left: 5px">{{scope.row.eventDate}}</span>
          </template>
        </el-table-column>
        <el-table-column property="updateTime" label="提交时间" width="120" sortable :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <i class="el-icon-time"></i>
            <span style="margin-left: 5px">{{scope.row.updateTime}}</span>
          </template>
        </el-table-column>
        <el-table-column property="reporterName" label="提交人姓名" width="120" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column property="clinicalDiagnosis" label="临床诊断" width="120" :show-overflow-tooltip="true"></el-table-column>

        <el-table-column property="reactionsName" label="反应/事件名称" width="120" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column property="reactionsDate" label="反应/事件发生日期" width="150" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column property="reactionsDescribe" label="过程描述" width="120" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column property="expression" label="表现" width="120" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column property="reactionsImpact" label="影响" width="120" :show-overflow-tooltip="true"></el-table-column>

        <el-table-column property="status" label="提交状态" width="120" sortable :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span v-if="scope.row.status=='1'" style="margin-left: 5px;color: #007df8">已保存</span>
            <span v-if="scope.row.status=='2'" style="margin-left: 5px;color: #13ce66">已审核</span>
            <span v-if="scope.row.status=='-99'" style="margin-left: 5px;color: red">审核不通过</span>
          </template>
        </el-table-column>
        <!--      <el-table-column property="name" label="此时发生" width="120" :show-overflow-tooltip="true"></el-table-column>-->
        <el-table-column label="操作" width="180" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button plain circle icon="el-icon-edit-outline" type="primary" title="编辑" size="small"
                       @click="rowEdit(scope.$index, scope.row)"></el-button>
            <el-button plain circle icon="el-icon-check" type="success" title="审核通过" size="small"
                       @click="rowDel(scope.$index, scope.row, $event);"></el-button>
            <el-button plain circle icon="el-icon-close" type="danger" title="审核不通过" size="small"
                       @click="rowDel1(scope.$index, scope.row, $event);"></el-button>
            <el-button plain circle icon="el-icon-delete" type="danger" title="删除" size="small"
                       @click="rowDel12(scope.$index, scope.row, $event);"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--分页-->
      <el-pagination
        :page-sizes="[10, 20, 30, 40]"
        :page-size="10"
        :total="tableData.length"
        layout="total, sizes, prev, pager, next, jumper">
      </el-pagination>
      <!--编辑-弹出层-->
      <my-dialog
        title="新增"
        :visible.sync="isShowEditDialog"
        draggable
        target="body"
        width="1000px"
        height="700px"
        @submit="handleSubmit"
        @close="dialogClose">
        <el-form
          ref="editForm"
          :model="formFileds"
          label-width="55px"
        >
<!--          <el-row type="flex">-->
<!--            <el-col :span="12">-->
<!--              <el-form-item label="患者资料" prop="name" label-width="120px">-->
<!--                <el-checkbox-group v-model="checkList">-->
<!--                  <el-checkbox label="就诊卡号"></el-checkbox>-->
<!--                  <el-checkbox label="处方号"></el-checkbox>-->
<!--                  <el-checkbox label="健康号"></el-checkbox>-->
<!--                </el-checkbox-group>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="12">-->
<!--              <el-input v-model="formFileds.col2" style="width: 300px"></el-input>-->
<!--            </el-col>-->
<!--          </el-row>-->
<!--          <el-row>-->
<!--            <el-col :span="8">-->
<!--              <el-form-item label="姓名" prop="address" label-width="120px">-->
<!--                <el-input v-model="formFileds.col3"></el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="8">-->
<!--              <el-form-item label="出生日期" prop="address" label-width="120px">-->
<!--                &lt;!&ndash;              <el-input v-model="formFileds.col4"></el-input>&ndash;&gt;-->
<!--                <el-date-picker v-model="formFileds.col4" value-format="yyyy-MM-dd" :editable="false" :clearable="false"></el-date-picker>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="8">-->
<!--              <el-form-item label="性别" prop="address" label-width="120px">-->
<!--                <el-input v-model="formFileds.col5"></el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--          </el-row>-->
<!--          <el-row>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="体重" prop="address" label-width="120px">-->
<!--                <el-input v-model="formFileds.col6"></el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="联系电话" prop="address" label-width="120px">-->
<!--                <el-input v-model="formFileds.col7"></el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="过敏史" prop="address" label-width="120px">-->
<!--                <el-input v-model="formFileds.col8"></el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="家族史" prop="address" label-width="120px">-->
<!--                <el-input v-model="formFileds.col9"></el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--          </el-row>-->
<!--          <el-row>-->
<!--            <el-form-item label="临床诊断" prop="address" label-width="120px">-->
<!--              <el-input v-model="formFileds.col10"></el-input>-->
<!--            </el-form-item>-->
<!--          </el-row>-->

          <el-row>
            <el-col :span="12">
              <el-form-item label="报告日期" label-width="100px">
                <el-date-picker v-model="formFileds.adverseDate" value-format="yyyy-MM-dd" :editable="false" :clearable="false"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="事件发生时间" label-width="120px">
                <el-date-picker v-model="formFileds.eventDate" value-format="yyyy-MM-dd" :editable="false" :clearable="false"></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row type="flex">
            <el-col :span="8">
              <el-form-item label="病案号" prop="name" label-width="100px">
                <el-input v-model="formFileds.patientId"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="姓名" prop="name">
                <el-input v-model="formFileds.patientName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="性别" prop="name">
                <el-input v-model="formFileds.sex"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row type="flex">
            <el-col :span="8">
              <el-form-item label="年龄" prop="name" label-width="100px">
                <el-input v-model="formFileds.age"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="科室" prop="name">
                <el-input v-model="formFileds.departName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="床号" prop="name">
                <el-input v-model="formFileds.bedNo"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-form-item label="临床诊断" prop="address" label-width="100px">
              <el-input v-model="formFileds.clinicalDiagnosis"></el-input>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="事件发生场所" prop="address" label-width="120px">
              <el-checkbox-group v-model="checkList8" :max="1">
                <el-checkbox label="1">急诊</el-checkbox>
                <el-checkbox label="2">门诊</el-checkbox>
                <el-checkbox label="3">病区</el-checkbox>
                <el-checkbox label="4">医技部门</el-checkbox>
                <el-checkbox label="99">其他</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-row>
          <el-divider style="color: red;" content-position="left">不良反应/事件</el-divider>

          <el-row>
            <el-col :span="12">
              <el-form-item label="事件名称" prop="address" label-width="120px">
                <el-input v-model="formFileds.reactionsName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="发生时间" prop="address" label-width="120px">
                <el-date-picker v-model="formFileds.reactionsDate" value-format="yyyy-MM-dd" :editable="false" :clearable="false"></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-form-item label="过程描述" prop="address" label-width="120px">
              <el-input type="textarea" v-model="formFileds.reactionsDescribe"></el-input>
            </el-form-item>
          </el-row>

          <el-row>
            <el-col :span="16">
              <el-form-item label="不良反应/事件的结果" prop="address" label-width="150px">
                <el-checkbox-group v-model="checkList" :max="1">
                  <el-checkbox label="1">痊愈</el-checkbox>
                  <el-checkbox label="2">好转</el-checkbox>
                  <el-checkbox label="3">未好转</el-checkbox>
                  <el-checkbox label="4">不详</el-checkbox>
                  <el-checkbox label="5">有后遗症</el-checkbox>
                  <el-input style="width: 150px;margin-right: 1vw" placeholder="有后遗症表现" v-model="formFileds.expression"></el-input>
                  <el-checkbox label="6">死亡</el-checkbox>
                  <el-input style="width: 150px;margin: 0 1vw" placeholder="直接死因" v-model="formFileds.dieReason"></el-input>
                </el-checkbox-group>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="死亡时间" prop="address" label-width="120px">
                <el-date-picker v-model="formFileds.dieDate" value-format="yyyy-MM-dd" :editable="false" :clearable="false"></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>

          <el-divider content-position="left">停药或减量后，反应/事件是否消失或减轻</el-divider>

          <el-row>
            <el-form-item label="" prop="address" label-width="120px">
              <el-checkbox-group v-model="checkList1" :max="1">
                <el-checkbox label="1">是</el-checkbox>
                <el-checkbox label="2">否</el-checkbox>
                <el-checkbox label="3">不明</el-checkbox>
                <el-checkbox label="4">未停药或未减量</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-row>

          <el-divider content-position="left">再次使用可疑药品后是否再次出现同样反应/事件</el-divider>

          <el-row>
            <el-form-item label="" prop="address" label-width="120px">
              <el-checkbox-group v-model="checkList2" :max="1">
                <el-checkbox label="1">是</el-checkbox>
                <el-checkbox label="2">否</el-checkbox>
                <el-checkbox label="3">不明</el-checkbox>
                <el-checkbox label="4">未再使用</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-row>

          <el-divider content-position="left">对原患疾病的影响/事件</el-divider>

          <el-row>
            <el-form-item label="" prop="address" label-width="120px">
              <el-checkbox-group v-model="checkList3" :max="1">
                <el-checkbox label="1">不明显</el-checkbox>
                <el-checkbox label="2">病程延长</el-checkbox>
                <el-checkbox label="3">病情加重</el-checkbox>
                <el-checkbox label="4">导致后遗症</el-checkbox>
                <el-checkbox label="5">导致死亡</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-row>

          <el-divider content-position="left">关联性评价</el-divider>

          <el-row>
            <el-form-item label="报告人评价" prop="address" label-width="120px">
              <el-checkbox-group v-model="checkList4" :max="1">
                <el-checkbox label="1">肯定</el-checkbox>
                <el-checkbox label="2">很可能</el-checkbox>
                <el-checkbox label="3">可能</el-checkbox>
                <el-checkbox label="4">可能无关</el-checkbox>
                <el-checkbox label="6">待评价</el-checkbox>
                <el-checkbox label="5">无法评价</el-checkbox>
                <el-input style="width: 150px;margin: 0 1vw" placeholder="签名" v-model="formFileds.reporterEvaluationSignature"></el-input>
              </el-checkbox-group>
            </el-form-item>
          </el-row>

          <el-row>
            <el-form-item label="报告单位评价" prop="address" label-width="120px">
              <el-checkbox-group v-model="checkList5" :max="1">
                <el-checkbox label="1">肯定</el-checkbox>
                <el-checkbox label="2">很可能</el-checkbox>
                <el-checkbox label="3">可能</el-checkbox>
                <el-checkbox label="4">可能无关</el-checkbox>
                <el-checkbox label="6">待评价</el-checkbox>
                <el-checkbox label="5">无法评价</el-checkbox>
                <el-input style="width: 150px;margin: 0 1vw" placeholder="签名" v-model="formFileds.unitSignature"></el-input>
              </el-checkbox-group>
            </el-form-item>
          </el-row>

          <el-divider content-position="left">报告人信息</el-divider>

          <el-row>
            <el-col :span="12">
              <el-form-item label="联系电话" prop="address" label-width="120px">
                <el-input v-model="formFileds.reporterPhone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="电子邮箱" prop="address" label-width="120px">
                <el-input v-model="formFileds.reporterEmail"></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
              <el-form-item label="职业" prop="address" label-width="120px">
                <el-checkbox-group v-model="checkList6" :max="1">
                  <el-checkbox label="1">医生</el-checkbox>
                  <el-checkbox label="2">药师</el-checkbox>
                  <el-checkbox label="3">护士</el-checkbox>
                  <el-checkbox label="4">其他</el-checkbox>
                </el-checkbox-group>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="签名" prop="address" label-width="120px">
                <el-input v-model="formFileds.reporterSignature"></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-divider content-position="left">报告单位信息</el-divider>

          <el-row>
            <el-col :span="12">
              <el-form-item label="单位名称" prop="address" label-width="120px">
                <el-input v-model="formFileds.unitName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="联系人" prop="address" label-width="120px">
                <el-input v-model="formFileds.contact"></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
              <el-form-item label="单位电话" prop="address" label-width="120px">
                <el-input v-model="formFileds.unitPhone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="报告日期" prop="address" label-width="120px">
                <el-date-picker v-model="formFileds.unitDate" value-format="yyyy-MM-dd" :editable="false" :clearable="false"></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>

          <el-divider content-position="left">生产企业请填写信息来源</el-divider>

          <el-row>
            <el-form-item label="" prop="address" label-width="120px">
              <el-checkbox-group v-model="checkList7" :max="1">
                <el-checkbox label="1">医疗机构</el-checkbox>
                <el-checkbox label="2">经营企业</el-checkbox>
                <el-checkbox label="3">个人</el-checkbox>
                <el-checkbox label="4">文献报道</el-checkbox>
                <el-checkbox label="5">上市后研究</el-checkbox>
                <el-checkbox label="6">其他</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-row>

          <el-row>
            <el-form-item label="备注" prop="address" label-width="120px">
              <el-input type="textarea" v-model="formFileds.remark"></el-input>
            </el-form-item>
          </el-row>

        </el-form>
      </my-dialog>
    </div>
  </my-wrapper>
</template>

<script>
  import {addMedicineEvent,editMedicineEvent,medicineQueryPage,deleteMedicineEvent} from '@/api/account.js';
  export default {
    name: "Table",
    data() {
      return {
        checkList:[],
        checkList1:[],
        checkList2:[],
        checkList3:[],
        checkList4:[],
        checkList5:[],
        checkList6:[],
        checkList7:[],
        checkList8:[],
        doubtMedicines: [
          {
            "doubtApprovalNumber": "1",
            "doubtBatchNumber": "1",
            "doubtCommonName": "1",
            "doubtManufacturer": "1",
            "doubtProductName": "1",
            "doubtReason": "1",
            "doubtStartTime": "2022-05-01",
            "doubtUsage": "1"
          }
        ],
        blendMedicines: [
          {
            "doubtApprovalNumber": "1",
            "doubtBatchNumber": "1",
            "doubtCommonName": "1",
            "doubtManufacturer": "1",
            "doubtProductName": "1",
            "doubtReason": "1",
            "doubtStartTime": "2022-05-01",
            "doubtUsage": "1"
          }
        ],
        formFileds: {
          date: '',
          name: '',
          address: '',
          id: '',


          eventId:undefined,
          hospitalName:undefined,
          reportType:'1',
          adverseDate:undefined,//上报不良事件日期date
          eventDate:undefined,
          departName:'内科',//科室
          departId:'101',//科室编码
          reporterName:'主任医生',//报告人
          reporterId:'001',//报告人编码

          //患者基本情况
          patientName:'张三',//患者姓名
          birthday:undefined,//出生日期date
          ageType:undefined,//年龄类型
          age:30,//年龄
          sex:'男',//性别
          patientId:'1001',//病历号
          patientNo:'1001',//病历号
          medicalHistory:'无',//既往病史
          bedNo:102,//床号
          clinicalDiagnosis:'扁桃体发炎',//临床诊断
          weight:undefined,//体重
          phone:undefined,//联系方式
          national:undefined,//民族
          pastReactionsType:'1',//既往药品不良反应/事件
          pastReactions:undefined,//有的话  药品名称
          familialReactions:undefined,//家族药品不良反应/事件
          familialReactionsType:'1',//家族药品

          reactionsName:undefined,//不良反应/事件名称
          reactionsDate:undefined,//不良反应/事件发生时间
          reactionsDescribe:undefined,//不良反应/事件过程描述
          dieReason:undefined,//直接死因
          dieDate:undefined,//死亡时间
          reactionsResultType:undefined,//不良反应/事件的结果
          expression:undefined,//表现
          appearType1:undefined,//停药或减量后，反应/事件是否消失或减轻？
          appearType2:undefined,//再次使用可疑药品后是否再次出现同样反应/事件？
          reactionsImpact:undefined,//对原患疾病的影响
          reporterEvaluation:undefined,//报告人评价
          reporterEvaluationSignature:undefined,//// 签名
          reporterSignature:undefined,// 签名
          unitEvaluation:undefined,//报告单位评价
          unitSignature:undefined,//签名

          //报告人信息
          reporterPhone:undefined,//联系电话
          reporterEmail:undefined,//电子邮箱
          reporterProfession:undefined,//职业

          //报告单位信息
          unitName:undefined,//单位名称
          contact:undefined,//联系人
          unitPhone:undefined,//单位电话
          unitDate:undefined,//报告日期
          informationSource:undefined,//生产企业请填写信息来源
          remark:undefined,//备注

        },
        rules: {
          name: [
            {required: true, message: '姓名不能为空', trigger: 'blur, change'}
          ],
          address: [
            {required: true, message: '地址不能为空', trigger: 'blur, change'}
          ]
        },
        tableData: [],
        isShowEditDialog: false
      }
    },
    created() {
      this.getData();
    },
    methods: {
      formatDate(now, type) {
        let date = new Date(now)
        let y = date.getFullYear() // 年份
        let m = date.getMonth() + 1 // 月份，注意：js里的月要加1
        if (m < 10) {
          m = "0" + m;
        }
        let d = date.getDate() // 日
        if (d < 10) {
          d = "0" + d;
        }
        if (type == "1") {
          // 返回值，根据自己需求调整，现在已经拿到了年月日时分秒了
          return y + '-' + m + '-' + d
        } else if (type == "2") {
          return m + '.' + d
        }
      },
      getData(){
        medicineQueryPage({"condition": {}, size: 10, current: 1}).then(response => {
          console.info(response)
          if (response.code === 0) {
            //localStorage.setItem("token",response.data.token);
            this.tableData = response.data.records;
          }
        });
      },
      rowNew(){
        this.resetForm();
        this.formFileds.adverseDate = this.formatDate(new Date().getTime(),"1");
        this.formFileds.eventDate = this.formFileds.adverseDate;
        this.isShowEditDialog = true;
      },
      handleRowClick(row, event, column) {
        // 仅选中当前行
        this.setCurRowChecked(row);
      },
      handleCheckedAllAndCheckedNone(selection) {
        // 当前选中仅一行时操作-（当前表格行高亮）
        1 != selection.length && this.$refs.list.setCurrentRow();
      },
      dialogClose() {
        // 清空编辑表单
        this.$refs.editForm.resetFields();
      },
      //清空表单信息
      resetForm(){
        this.checkList =[];
        this.checkList1 = [];
        this.checkList2 = [];
        this.checkList3 = [];
        this.checkList4 = [];
        this.checkList5 = [];
        this.checkList6 = [];
        this.checkList7 = [];
        this.checkList8 = [];
        this.formFileds={
          date: '',
          name: '',
          address: '',
          id: '',


          eventId:undefined,
          hospitalName:undefined,
          reportType:'1',
          adverseDate:undefined,//上报不良事件日期date
          eventDate:undefined,
          departName:'内科',//科室
          departId:'101',//科室编码
          reporterName:'主任医生',//报告人
          reporterId:'001',//报告人编码

          //患者基本情况
          patientName:'张三',//患者姓名
          birthday:undefined,//出生日期date
          ageType:undefined,//年龄类型
          age:30,//年龄
          sex:'男',//性别
          patientId:'1001',//病历号
          patientNo:'1001',//病历号
          medicalHistory:'无',//既往病史
          bedNo:102,//床号
          clinicalDiagnosis:'扁桃体发炎',//临床诊断
          weight:undefined,//体重
          phone:undefined,//联系方式
          national:undefined,//民族
          pastReactionsType:'1',//既往药品不良反应/事件
          pastReactions:undefined,//有的话  药品名称
          familialReactions:undefined,//家族药品不良反应/事件
          familialReactionsType:'1',//家族药品

          reactionsName:undefined,//不良反应/事件名称
          reactionsDate:undefined,//不良反应/事件发生时间
          reactionsDescribe:undefined,//不良反应/事件过程描述
          dieReason:undefined,//直接死因
          dieDate:undefined,//死亡时间
          reactionsResultType:undefined,//不良反应/事件的结果
          expression:undefined,//表现
          appearType1:undefined,//停药或减量后，反应/事件是否消失或减轻？
          appearType2:undefined,//再次使用可疑药品后是否再次出现同样反应/事件？
          reactionsImpact:undefined,//对原患疾病的影响
          reporterEvaluation:undefined,//报告人评价
          reporterEvaluationSignature:undefined,//// 签名
          reporterSignature:undefined,// 签名
          unitEvaluation:undefined,//报告单位评价
          unitSignature:undefined,//签名

          //报告人信息
          reporterPhone:undefined,//联系电话
          reporterEmail:undefined,//电子邮箱
          reporterProfession:undefined,//职业

          //报告单位信息
          unitName:undefined,//单位名称
          contact:undefined,//联系人
          unitPhone:undefined,//单位电话
          unitDate:undefined,//报告日期
          informationSource:undefined,//生产企业请填写信息来源
          remark:undefined,//备注
        }
      },
      tableDblclick(row, column, event){
        // this.checkList = row.col1 == null? [] : row.col1
        // this.checkList1 = row.col12 == null? [] : row.col12
        // this.checkList2 = row.col18 == null? [] : row.col18
        // this.checkList3 = row.col19 == null? [] : row.col19
        // this.setCurRowChecked(row);
        // // 给编辑弹出层赋值
        // // ***这里需要注意的是：因为加了排序 所以tableData的顺序和实际显示的行顺序不一样
        // for (let key in this.formFileds) {
        //   this.formFileds[key] = row[key];
        // }
        // this.isShowEditDialog = true;
      },
      rowEdit(index, row) {
        let that = this;
        this.resetForm();
        if(row.reactionsResultType != null){
          this.checkList.push(row.reactionsResultType);
        }
        if(row.appearType1 != null){
          this.checkList1.push(row.appearType1);
        }
        if(row.appearType2 != null){
          this.checkList2.push(row.appearType2);
        }
        if(row.reactionsImpact != null){
          this.checkList3.push(row.reactionsImpact);
        }
        if(row.reporterEvaluation != null){
          this.checkList4.push(row.reporterEvaluation);
        }
        if(row.unitEvaluation != null){
          this.checkList5.push(row.unitEvaluation);
        }
        if(row.reporterProfession != null){
          this.checkList6.push(row.reporterProfession);
        }
        if(row.informationSource != null){
          this.checkList7.push(row.informationSource);
        }
        this.setCurRowChecked(row);
        // 给编辑弹出层赋值
        // ***这里需要注意的是：因为加了排序 所以tableData的顺序和实际显示的行顺序不一样
        for (let key in this.formFileds) {
          this.formFileds[key] = row[key];
        }
        that.isShowEditDialog = true;
      },
      handleEdit(id) {
        let that = this;
        this.formFileds.reactionsResultType = this.checkList[0]
        this.formFileds.appearType1 = this.checkList1[0]
        this.formFileds.appearType2 = this.checkList2[0]
        this.formFileds.reactionsImpact = this.checkList3[0]
        this.formFileds.reporterEvaluation = this.checkList4[0]
        this.formFileds.unitEvaluation = this.checkList5[0]
        this.formFileds.reporterProfession = this.checkList6[0]
        this.formFileds.informationSource = this.checkList7[0]

        this.formFileds.blendMedicines = this.blendMedicines;
        this.formFileds.doubtMedicines = this.doubtMedicines;
        this.$refs.editForm.validate(isValid => {
          if (!isValid) return;
          // 保存编辑后的数据
          this.tableData.forEach(function(val,index){
            if(val.id == id){
              Object.assign(that.tableData[index], that.formFileds);
            }
          })
          that.isShowEditDialog = false;
          // 考虑到可能编辑了日期-需要重新排序
          // ***注意：手动排序传参和表格的default-sort属性格式不太一样
          this.$refs.list.sort('date', 'descending');
          this.$message.success('编辑成功');
        });
      },
      handleSubmit(){
        this.formFileds.reactionsResultType = this.checkList[0]
        this.formFileds.appearType1 = this.checkList1[0]
        this.formFileds.appearType2 = this.checkList2[0]
        this.formFileds.reactionsImpact = this.checkList3[0]
        this.formFileds.reporterEvaluation = this.checkList4[0]
        this.formFileds.unitEvaluation = this.checkList5[0]
        this.formFileds.reporterProfession = this.checkList6[0]
        this.formFileds.informationSource = this.checkList7[0]

        this.formFileds.blendMedicines = this.blendMedicines;
        this.formFileds.doubtMedicines = this.doubtMedicines;
        if(this.formFileds.eventId!=null&&this.formFileds.eventId!=""){
          // this.handleEdit(this.formFileds.id);
          this.formFileds.status = '2';
          editMedicineEvent(this.formFileds).then(response => {
            console.info(response)
            if(response.code===0){
              this.$message.success(response.msg);
              this.getData();
              this.isShowEditDialog = false;
            }else{
              this.$message.error(response.msg);
            }
          });
        }else{
          this.formFileds.status = '1';
          addMedicineEvent(this.formFileds).then(response => {
            console.info(response)
            if(response.code===0){
              //localStorage.setItem("token",response.data.token);
              this.$message.success(response.msg);
              this.tableData.push(this.formFileds);
              // this.formFileds.id = new Date().getTime();
              this.isShowEditDialog = false;
            }else{
              this.$message.error(response.msg);
            }
          });
          // this.tableData.push(this.formFileds);
          // this.resetForm();
        }
      },
      rowDel(index, row, event) {
        let that = this;
        // 让当前删除按钮失焦
        event.target.blur();
        this.$confirm('确定要审核当前行吗？', '审核', {
          comfirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(() => {
          //this.tableData.splice(row.id, 1);
          row.status = '2'
          editMedicineEvent(row).then(response => {
            console.info(response)
            if(response.code===0){
              this.$message.success('审核成功');
              this.getData();
            }else{
              this.$message.error(response.msg);
            }
          });
          return false;
        });
      },
      rowDel1(index, row, event) {
        let that = this;
        // 让当前删除按钮失焦
        event.target.blur();
        this.$confirm('确定要审核当前行吗？', '审核', {
          comfirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(() => {
          //this.tableData.splice(row.id, 1);
          row.status = '-99'
          editMedicineEvent(row).then(response => {
            console.info(response)
            if(response.code===0){
              this.$message.success('审核成功');
              this.getData();
            }else{
              this.$message.error(response.msg);
            }
          });
          return false;
        });
      },
      rowDel12(index, row, event) {
        let that = this;
        // 让当前删除按钮失焦
        event.target.blur();
        this.$confirm('确定要删除当前行吗？', '删除', {
          comfirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(() => {
          deleteMedicineEvent({"eventId":row.eventId}).then(response => {
            console.info(response)
            if(response.code===0){
              this.$message.success(response.msg);
              this.getData();
            }else{
              this.$message.error(response.msg);
            }
          });
          return false;
        });
      },
      // 选中当前行-当前行的复选框被勾选
      setCurRowChecked(row) {
        this.$refs.list.clearSelection();
        this.$refs.list.toggleRowSelection(row);
      }
    }
  }
</script>

<style scoped lang="scss">
  .el-form {
    padding: 0 10px;
  }
  .el-date-editor {
    width: 100% !important;
  }
  /deep/ {
    .my-wrapper__body {
      padding-bottom: 0 !important;
    }
  }
  ::v-deep .el-table{
    font-size: 11px;
  }

  .el-divider{
    background-color: #40a9ff;
  }

  .el-divider__text{
    color: #007df8;
  }
</style>
